Skip to content

Conversation

@maxisbey
Copy link
Contributor

@maxisbey maxisbey commented Jan 16, 2026

Summary

Moves the Starlette app creation logic for streamable HTTP transport from FastMCP down to the lowlevel Server, and relocates StreamableHTTPASGIApp to streamable_http_manager.py.

Changes

  • Move streamable_http_app() implementation to lowlevel Server: The Starlette app creation (routes, middleware, auth setup) now lives in the lowlevel Server class. FastMCP's method becomes a thin wrapper that passes through its settings.

  • Move StreamableHTTPASGIApp to streamable_http_manager.py: This ASGI app class directly wraps StreamableHTTPSessionManager, so it belongs in the same module.

  • Add session_manager property to lowlevel Server: Exposes the session manager after streamable_http_app() is called. FastMCP's property now delegates to this.

  • Fix circular import: Use TYPE_CHECKING in streamable_http_manager.py for the Server import since it's only needed for type annotations.

Why

The lowlevel Server shouldn't depend on FastMCP. Previously, it imported StreamableHTTPASGIApp from FastMCP, inverting the expected dependency hierarchy. This refactor ensures dependencies flow in one direction: FastMCP → lowlevel.

- Move StreamableHTTPASGIApp from fastmcp/server.py to streamable_http.py
- Move streamable_http_app() implementation from FastMCP to lowlevel Server
- Add session_manager property to lowlevel Server, FastMCP delegates to it
- Fix circular import by using TYPE_CHECKING in streamable_http_manager.py

Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 8
Claude-Permission-Prompts: 1
Claude-Escapes: 0
Move StreamableHTTPASGIApp from streamable_http.py to streamable_http_manager.py
since it directly depends on StreamableHTTPSessionManager.

Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 0
Claude-Permission-Prompts: 2
Claude-Escapes: 0
Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 0
Claude-Permission-Prompts: 1
Claude-Escapes: 0
@maxisbey maxisbey requested a review from Kludex January 16, 2026 17:36
@maxisbey maxisbey changed the title refactor: move StreamableHTTPASGIApp to streamable_http module refactor: move streamable HTTP app creation from FastMCP to lowlevel Server Jan 16, 2026
Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 1
Claude-Permission-Prompts: 1
Claude-Escapes: 0
…evel streamable_http_app()

Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 0
Claude-Permission-Prompts: 1
Claude-Escapes: 1
Comment on lines +225 to +239
### `StreamableHTTPASGIApp` moved to `streamable_http_manager` module

The `StreamableHTTPASGIApp` class has been moved from `mcp.server.fastmcp.server` to `mcp.server.streamable_http_manager`.

**Before (v1):**

```python
from mcp.server.fastmcp.server import StreamableHTTPASGIApp
```

**After (v2):**

```python
from mcp.server.streamable_http_manager import StreamableHTTPASGIApp
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is supposed to have been public. No note needed for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants